Telegram Group & Telegram Channel
Can't step through code in VS Code + OpenOCD + GDB with RISC-V — everything connects but stepping doesn't work


Hi! I'm setting up debugging for a RISC-V project in VS Code using the Cortex-Debug extension. I'm using OpenOCD and `riscv32-unknown-elf-gdb`. The configuration seems to launch correctly: OpenOCD starts, GDB connects, and the ELF file (`main.elf`) is loaded. A breakpoint in `main()` also sets successfully.

But then I run into problems:

* After `exec-continue`, the program stops at `0x00010058 in ?? ()`.
* The breakpoint in `main()` doesn’t hit, and I can’t step through the code (step over / step into doesn’t work).
* `main()` is at `0x400000c0`, and the ELF is built with `-g`, but something is clearly off.

# What I’ve checked:

* `"showDevDebugOutput": "parsed"` is set
* The ELF file contains debug symbols (verified with `nm`, `objdump`)
* Using custom `riscv.cfg` and my own `startup.S`
* Using `riscv32-unknown-elf-gdb` and OpenOCD listening on `localhost:50000`
* `readelf` shows the entry point does **not** match the address of `main()`

launch.json

{
"configurations": [
{
"name": "RISCV",
"type": "cortex-debug",
"request": "launch",
// "showDevDebugOutput": "parsed",
"servertype": "openocd",
"cwd": "${workspaceFolder}",
"executable": "./build/main.elf",
"gdbTarget": "localhost:50000",
"configFiles": [
"lib/riscv.cfg"
],
"postLaunchCommands": [
"load"
],
"runToEntryPoint": "main"
}
]
}

settings.json

{
"cortex-debug.openocdPath": "/usr/bin/openocd",
"cortex-debug.variableUseNaturalFormat": true,
"cortex-debug.gdbPath": "/home/riscv/bin/riscv32-unknown-elf-gdb",
"search.exclude": {
"**/build": true
},
"files.associations": {
"printf_uart.h": "c"
}
}

https://redd.it/1kr1rao
@r_riscv



tg-me.com/r_riscv/3338
Create:
Last Update:

Can't step through code in VS Code + OpenOCD + GDB with RISC-V — everything connects but stepping doesn't work


Hi! I'm setting up debugging for a RISC-V project in VS Code using the Cortex-Debug extension. I'm using OpenOCD and `riscv32-unknown-elf-gdb`. The configuration seems to launch correctly: OpenOCD starts, GDB connects, and the ELF file (`main.elf`) is loaded. A breakpoint in `main()` also sets successfully.

But then I run into problems:

* After `exec-continue`, the program stops at `0x00010058 in ?? ()`.
* The breakpoint in `main()` doesn’t hit, and I can’t step through the code (step over / step into doesn’t work).
* `main()` is at `0x400000c0`, and the ELF is built with `-g`, but something is clearly off.

# What I’ve checked:

* `"showDevDebugOutput": "parsed"` is set
* The ELF file contains debug symbols (verified with `nm`, `objdump`)
* Using custom `riscv.cfg` and my own `startup.S`
* Using `riscv32-unknown-elf-gdb` and OpenOCD listening on `localhost:50000`
* `readelf` shows the entry point does **not** match the address of `main()`

launch.json

{
"configurations": [
{
"name": "RISCV",
"type": "cortex-debug",
"request": "launch",
// "showDevDebugOutput": "parsed",
"servertype": "openocd",
"cwd": "${workspaceFolder}",
"executable": "./build/main.elf",
"gdbTarget": "localhost:50000",
"configFiles": [
"lib/riscv.cfg"
],
"postLaunchCommands": [
"load"
],
"runToEntryPoint": "main"
}
]
}

settings.json

{
"cortex-debug.openocdPath": "/usr/bin/openocd",
"cortex-debug.variableUseNaturalFormat": true,
"cortex-debug.gdbPath": "/home/riscv/bin/riscv32-unknown-elf-gdb",
"search.exclude": {
"**/build": true
},
"files.associations": {
"printf_uart.h": "c"
}
}

https://redd.it/1kr1rao
@r_riscv

BY RISC-V Reddit




Share with your friend now:
tg-me.com/r_riscv/3338

View MORE
Open in Telegram


RISC V Reddit Telegram | DID YOU KNOW?

Date: |

Telegram today rolling out an update which brings with it several new features.The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations.

China’s stock markets are some of the largest in the world, with total market capitalization reaching RMB 79 trillion (US$12.2 trillion) in 2020. China’s stock markets are seen as a crucial tool for driving economic growth, in particular for financing the country’s rapidly growing high-tech sectors.Although traditionally closed off to overseas investors, China’s financial markets have gradually been loosening restrictions over the past couple of decades. At the same time, reforms have sought to make it easier for Chinese companies to list on onshore stock exchanges, and new programs have been launched in attempts to lure some of China’s most coveted overseas-listed companies back to the country.

RISC V Reddit from in


Telegram RISC-V Reddit
FROM USA